<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理平台</title>
<meta http-equiv="MSThemeCompatible" content="Yes" />
<script src="<?php echo base_url()?>public/js/jquery-1.7.2.min.js"></script>
<link href="<?php echo base_url()?>public/css/bootstrap.min.css" rel="stylesheet" type="text/css" />

<script src="<?php echo base_url()?>public/js/bootstrap.min.js" type="text/javascript"></script>
</head>
<body>
<?php if (!isset($error)){?>
<div style="background:#fefbe4;border:1px solid #f3ecb9;color:#993300;padding:10px;width:90%;margin:40px auto 5px auto;">选中文件后点击上传按钮</div>
<form enctype="multipart/form-data" action="" id="thumbForm" method="POST" style="width:90%;margin: auto;font-size:14px;">
	<p>
	<input type="file" style="width:100%;border:1px solid #ddd" name="photo" 
	<?php if (isset($domid)&&$domid=='kml_file')echo 'accept=".kml"';
	elseif (isset($domid)&&$domid=='apk_file')echo 'accept=".apk"';
	elseif (isset($domid)&&$domid=='excel_file')echo 'accept=".xlsx"';
	elseif (isset($domid)&&$domid=='file')echo 'accept="*"';
	else echo 'accept="image/*"';?>>
	</div>
	<div style="padding:20px 0;text-align:center;">
	<input id="submitbtn" name="doSubmit" type="submit" class="btn btn-info btn-flat" value="上传" onclick="this.value='上传中...'"></input>
	</div>
	</p>
</form>
<?php }else{ ?>
<div style="text-align:center;line-height:140px;font-size:14px;">
<?php if(isset($error)&&$error==0){echo '上传成功';}else{echo $msg;}?> 
</div>
<script>
var domid = '<?php if (isset($domid))echo $domid;?>';
var lat='<?php if (isset($lat)) echo $lat;else echo '0';?>';
var lon='<?php if (isset($lon)) echo $lon;else echo '0';?>';
var createtime = '<?php if (isset($createtime)) echo $createtime;?>'
// 返回数据到主页面
function returnHomepage(url){
	var origin = window.parent;
	var dom = origin.document.getElementById(domid);
	var domsrcid=domid+'_src';

	if(origin.document.getElementById(domsrcid)){
		origin.document.getElementById(domsrcid).src=url;
	}
	if(lat!=0){
		var dom1 = origin.document.getElementById('latitude');
		var dom2 = origin.document.getElementById('longitude');
		dom1.value=lat;
		dom2.value=lon;
	}
	if(createtime!=''){
		origin.document.getElementById('createtime').value=createtime;
	}
	if(domid!='excel_file'){
    	dom.value=url;
    	setTimeout(window.parent.uploadClose(), 1500);
	}
}
<?php if(isset($error)&&$error==0){?>
returnHomepage('<?php echo $msg;?>');
<?php }?>
</script>
<?php }?>
</body>
</html>